package com.chenglu.android.payment.adapter;

import android.widget.ImageView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chenglu.android.R;
import com.chenglu.android.goodsinfo.infoutils.GoodsInfoUtils;
import com.chenglu.android.payment.ComfirmOrderActivity;
import com.chenglu.android.payment.bean.ComfirmOrderBean;


import java.util.List;


/**
 * @author: lyj
 * @Created: by Copyright 2023/3/29 Guangzhou Hongma Technology Co., Ltd. All rights reserved.
 * @Description：创建订单布局
 */
public class ComfirmOrderAdapter extends BaseQuickAdapter<ComfirmOrderBean.Data.OrderBatchShopVOList, BaseViewHolder> {

    ComfirmOrderActivity orderActivity;

    public ComfirmOrderAdapter(ComfirmOrderActivity comfirmOrderActivity, int layoutResId, List<ComfirmOrderBean.Data.OrderBatchShopVOList> data) {
        super(layoutResId, data);
        this.orderActivity = comfirmOrderActivity;
    }

    @Override
    protected void convert(BaseViewHolder holder, ComfirmOrderBean.Data.OrderBatchShopVOList bean) {
        holder.setText(R.id.tv_cart_sellername, bean.getShopsName());
        ImageView imageView = holder.getView(R.id.iv_cart_seller);
        GoodsInfoUtils.setTypeShopsImageView(mContext,bean.getShopsTypeId(),imageView);
        ComfirmOrderItemAdapter mItemAdapter = new ComfirmOrderItemAdapter(orderActivity, R.layout.item_comfirm_order_cart, bean.getOrderGoodsDTOList());
        RecyclerView recyclerView = holder.getView(R.id.rv_cart_item);
        recyclerView.setLayoutManager(new LinearLayoutManager(orderActivity));
        recyclerView.setAdapter(mItemAdapter);
        mItemAdapter.notifyDataSetChanged();


    }
}
